package com.yfz.day02;


/**
 *  盛最多水的容器 11
 */

class Solution {
    public int maxArea(int[] height) {
         int start = 0 ,end = height.length -1;
         int max = 0;
         while(start <= end)
         {
             int sum = (end - start) * Math.min(height[start],height[end]);
             if(sum>=max) max= sum;

             if(height[start]>= height[end]) end--;
             else start++;
         }
         return max;
    }
}